Public Class Machine1

    Implements IMouse


    Dim speed As Integer = 0
    Const wheelCountMax As Integer = 20
    Const pbHeight As Integer = 200
    Const pbWidth As Integer = 20
    Const oneMeter As Integer = pbHeight / wheelCountMax
    Dim wCount As Integer = 0
    Const oneWheel As Integer = 120
    Const spdMax As Integer = oneWheel * wheelCountMax
    Const spdMin As Integer = 0

    Public mcnPt As Point() = {New Point(20, 20), New Point(23, 20), New Point(23, 21), New Point(20, 21)}
    Public mDrct As Object = Direction.N

    Enum PenType
        Create
        Erases
    End Enum
    Public Enum Direction
        N
        NNE
        NEE
        E
        ESS
        EES
        S
        SSW
        SWW
        W
        WWN
        WNN
    End Enum

    Public Sub Draw(ByVal g As System.Windows.Forms.PaintEventArgs, ByVal pType As Object)
        Static bb As New SolidBrush(Color.Black)
        Static bg As New SolidBrush(Color.Gray)

        Select Case pType
            Case PenType.Create
                g.Graphics.FillPolygon(bb, mcnPt)
            Case PenType.Erases
                g.Graphics.FillPolygon(bg, mcnPt)
        End Select

    End Sub
    Dim eee As System.Windows.Forms.PaintEventArgs = Nothing


    Public Sub Create() Implements IMouse.Create


        Draw(eee, PenType.Create)
    End Sub

    Public Sub Left() Implements IMouse.Left

        Select Case mDrct

            Case Direction.N
                mDrct = Direction.WNN
            Case Direction.NNE
                mDrct = Direction.N
            Case Direction.NEE
                mDrct = Direction.NNE
            Case Direction.E
                mDrct = Direction.NEE
            Case Direction.ESS
                mDrct = Direction.E
            Case Direction.EES
                mDrct = Direction.ESS
            Case Direction.S
                mDrct = Direction.EES
            Case Direction.SSW
                mDrct = Direction.S
            Case Direction.SWW
                mDrct = Direction.SSW
            Case Direction.W
                mDrct = Direction.SWW
            Case Direction.WWN
                mDrct = Direction.W
            Case Direction.WNN
                mDrct = Direction.WWN

        End Select
    End Sub

    Public Sub Right() Implements IMouse.Right

        Select Case mDrct

            Case Direction.N
                mDrct = Direction.NNE
            Case Direction.NNE
                mDrct = Direction.NEE
            Case Direction.NEE
                mDrct = Direction.E
            Case Direction.E
                mDrct = Direction.ESS
            Case Direction.ESS
                mDrct = Direction.EES
            Case Direction.EES
                mDrct = Direction.S
            Case Direction.S
                mDrct = Direction.SSW
            Case Direction.SSW
                mDrct = Direction.SWW
            Case Direction.SWW
                mDrct = Direction.W
            Case Direction.W
                mDrct = Direction.WWN
            Case Direction.WWN
                mDrct = Direction.WNN
            Case Direction.WNN
                mDrct = Direction.N

        End Select
    End Sub

    Public Sub Middle() Implements IMouse.Middle

        Select Case mDrct
            case 


        End Select

    End Sub
    Public Sub Roll() Implements IMouse.Roll

        Select Case mDrct
            case 


        End Select

    End Sub

    Public Sub SpeedControl(ByVal ChangeSpd As Integer)

        If speed > spdMin And speed < spdMax Then
            speed += ChangeSpd
            Kmr.Label1.Text = CStr(speed)
            wCount = pbHeight - speed / oneWheel * oneMeter

        ElseIf speed <= spdMin And ChangeSpd > 0 Then
            speed += ChangeSpd
            Kmr.Label1.Text = CStr(speed)
            wCount = pbHeight - speed / oneWheel * oneMeter

        ElseIf speed >= spdMax And ChangeSpd < 0 Then
            speed += ChangeSpd
            Kmr.Label1.Text = CStr(speed)
            wCount = pbHeight - speed / oneWheel * oneMeter
        End If

    End Sub





End Class
